package com.fearless.test20210504.volatileTest;

import java.util.concurrent.TimeUnit;

public class JMMDemo {
    private  static boolean flag=true;

    public static void main(String[] args) {
        new Thread(()->{
            while (flag){

            }
            System.out.println("线程结束");
        },"A").start();


        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        flag=false;

        System.out.println("主内存的值已经修改了奥"+flag);

    }


}
